home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 271_02 / fopenx.doc < prev    next >
Text File  |  1987-08-18  |  2KB  |  44 lines

  1.  
  2.  
  3.         NAME
  4.                 fopenp -- fopen a file in the PATH
  5.                 fopend -- fopen a file in an environment variable
  6.                 fopeng -- fopend/fopenp combination
  7.  
  8.         SYNOPSIS
  9.                 fd = fopenp(name, mode);
  10.                 fd = fopend(name, mode, envar);
  11.                 fd = fopeng(name, mode, envar);
  12.                 FILE *fd;
  13.                 char *name;        filename
  14.                 char *mode;        mode
  15.                 char *envar;       name of environment variable
  16.  
  17.         DESCRIPTION
  18.         These three functions allow the opening of a file in other than just
  19.         the current directory.  All functions will attempt the open in the
  20.         current directory first, and if that fails, will then expand to search:
  21.              fopenp -- searchs PATH environment variable
  22.              fopend -- searches a specified environment variable,
  23.                        with directories specified in the same syntax as for PATH
  24.              fopeng -- performs an fopend() first, and upon failure an fopenp()
  25.         These functions will return NULL pointers upon failure.  The file MUST
  26.         EXIST in order for a pointer to be returned.  Therefore, these
  27.         functions cannot be used to create new files.
  28.  
  29.         EXAMPLE
  30.  
  31.              FILE *fd;
  32.  
  33.              if((fd = fopenp("foo.bar", "r")) == NULL) cant("foo.bar");
  34.              else puts("File is now opened!");
  35.  
  36.              if((fd = fopend("stdio.h", "r", "INCLUDE")) == NULL)
  37.                   cant("stdio.h");
  38.              else puts("stdio.h is open for reading");
  39.  
  40.              /* fopeng works the same as fopend */
  41.  
  42.  
  43.         This function is found in SMTCx.LIB for the Turbo-C Compiler.
  44.